package com.gpframework.module.purchase.domain.req;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gpframework.common.utils.StringUtils;
import com.gpframework.module.base.domain.req.BaseReq;
import com.gpframework.module.purchase.domain.GpIngredientsTable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @ClassName GpIngredientsTableReq
 * @Author gpframework
 * @Date 2023-12-22
 * @Version 1.0.0
 * @Description 列表查询信息体
 */
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class GpIngredientsTableReq extends BaseReq {
    private static final long serialVersionUID = 1L;

         @ApiModelProperty("品牌id")
     private String brandId;
     @ApiModelProperty("品牌名称")
     private String brandName;
     @ApiModelProperty("供应商")
     private String supplier;
     @ApiModelProperty("产品品名")
     private String productName;
     @ApiModelProperty("密度")
     private String density;
     @ApiModelProperty("克重")
     private Long fabricWeight;
     @ApiModelProperty("门幅")
     private String doorWidth;
     @ApiModelProperty("仓库备货颜色")
     private String stockColor;
     @ApiModelProperty("录入人id")
     private Long enteredId;
     @ApiModelProperty("录入人")
     private String enteredMan;
     @ApiModelProperty("录入时间")
     private Date enteredTime;
     @ApiModelProperty("供应商分组")
     private String supplierGroupFlag;

    /**
    * @Description 生成查询wrapper
    * @Author greatplan@qq.com
    * @Date 2020-11-04 16:04
    * @Param [lqw]
    * @Param [isVO] 是否vo查询体，true的话走的是mapper.xml里面的查询语句，不过查询语法还是mybatis-plus，主要用于某些关联查询出一些非数据表字段
    * @Return void
    */
    public void generatorQuery(QueryWrapper<GpIngredientsTable> lqw,boolean isVo) {
        String alias = "";
        if (isVo) {
            alias = "gp.";
            lqw.eq(alias+"del_status",0);
        }
        if (StringUtils.isNotBlank(this.getBrandId())){
        lqw.eq(alias+"brand_id" ,this.getBrandId());
        }
        if (StringUtils.isNotBlank(this.getBrandName())){
            lqw.like(alias+"brand_name",this.getBrandName());
        }
        if (StringUtils.isNotBlank(this.getSupplier())){
        lqw.eq(alias+"supplier" ,this.getSupplier());
        }
        if (StringUtils.isNotBlank(this.getProductName())){
            lqw.like(alias+"product_name",this.getProductName());
        }
        if (StringUtils.isNotBlank(this.getDensity())){
        lqw.eq(alias+"density" ,this.getDensity());
        }
        if (this.getFabricWeight() != null){
        lqw.eq(alias+"fabric_weight" ,this.getFabricWeight());
        }
        if (this.getDoorWidth() != null){
        lqw.eq(alias+"door_width" ,this.getDoorWidth());
        }
        if (StringUtils.isNotBlank(this.getStockColor())){
        lqw.eq(alias+"stock_color" ,this.getStockColor());
        }
        if (this.getEnteredId() != null){
        lqw.eq(alias+"entered_id" ,this.getEnteredId());
        }
        if (StringUtils.isNotBlank(this.getEnteredMan())){
        lqw.eq(alias+"entered_man" ,this.getEnteredMan());
        }
        if (this.getEnteredTime() != null){
        lqw.eq(alias+"entered_time" ,this.getEnteredTime());
        }
        if (StringUtils.isNotBlank(this.getSupplierGroupFlag())){
        lqw.groupBy(alias+"supplier");
        }
    }
}
